//
//  YYLTrackViewController.m
//  YYLSport
//
//  Created by yangyinglei on 2017/4/23.
//  Copyright © 2017年 yangyinglei. All rights reserved.
//

#import "YYLTrackViewController.h"
#import "YYLMapViewController.h"

@interface YYLTrackViewController ()

@property (nonatomic, strong) YYLMapViewController *mapVc;

@end

@implementation YYLTrackViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (instancetype)init {
    if (self = [super init]) {
        [self setMapView];
    }
    return self;
}


- (void)setMapView{
    //新建地图
    YYLMapViewController *mapVc = [[YYLMapViewController alloc] init];
    //设置轨迹模型
    mapVc.track = self.track;
    
    [self addChildViewController:mapVc];
    [self.view addSubview:mapVc.view];
    mapVc.view.frame = self.view.bounds;
    
    [mapVc didMoveToParentViewController:self];
    self.mapVc = mapVc;
}

- (void)setTrack:(YYLSportTrack *)track {

    _track = track;
    self.mapVc.track = track;
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
